clear all
set more off, perm
set maxvar 120000
set varabbrev off
* ---------------------------------------------- *
global dir 	"`1'"
global Data 	$dir/Data
global Tables 	$dir/Tables
global Figures 	$dir/Figures
global Work 	$dir/Work
global Temp 	$dir/Temp
global Pseudo	$dir/Work/Temp
* ---------------------------------------------- *
* Appendix D1 with firm fxd effect
* ---------------------------------------------- * 
use $Work/Table09_June.dta, clear
local X "lnbeme lnmcap inv op L12ret"

eststo clear
generate cum=cumQNRetMo1
quietly: eststo: ivreghdfe 	cumRetNewMo1 	cum	`X', a(permco, resid) 

replace cum=cumQNRetQr1
quietly: eststo: ivreghdfe 	cumRetNewQr1 	cum	`X', a(permco, resid) dkraay(3) 

forvalues x=1(2)5 {
local lag=12*`x'
replace cum=cumQNRetYr`x'
quietly: eststo: ivreghdfe 	cumRetNewYr`x' cum	`X', a(permco, resid) dkraay(`lag') 
}
esttab , nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01) nolabel nogap stats(N r2 r2_a F) 

local file $Tables/AppendixD1_June.csv
esttab using `file', nonotes compress b(4) se(4) star(c 0.10 b 0.05 a 0.01) nolabel nogap stats(N  r2_a) replace
